#ifndef TTHREAD_H
#define TTHREAD_H

#include <QtGui>
#include "tstate.h"
#include <QObject>
#include "tnetworkmanager.h"

class TThread : public QObject
{
    Q_OBJECT
public:
    explicit TThread(QObject* parent = 0);
    explicit TThread(QUrl url, QString threadName = NULL, QObject* parent = 0);

    void startWatch(void);
    void stopWatch(void);

    void setThreadNumber(QString number);
    QString getThreadNumber(void);

    void setThreadBoard(QString board);
    QString getThreadBoard(void);

    void setURL(QUrl url);
    QUrl getURL(void);

    void setState(int stateNum);
    QString getState(void);
    QColor getColor(void);

    void setName(QString Name);
    QString getName(void);


private:
    QUrl URL;
    QString name;
    TState* state;
    QString lastReply;
    QString threadBoard;
    QString threadNumber;
    QString lastModified;
    QUrl jsonURL;
    QString fetchLastPost(QString data);
    QString fetchLastPost(void);
    QString fetchLastModified(QString data);
    QTimer* timer;
    TNetworkManager* nm;

signals:
    void isChanged(void);

private slots:
    void checkThread(void);

public slots:

};

#endif // TTHREAD_H
